package algorithm;

import java.util.Date;
import java.util.Objects;

public class ObjectTest {

    public static void main(String[] args) {

        Order d = new Order();
        d.i = 10;
        Order d2 = new Order();
        d2.i = 10;
        System.out.println(d.getClass());
        System.out.println(d.getClass().getSuperclass());




        String s1 = new String("a");
        String s2 = new String("a");

        System.out.println(s1.equals(s2));
        System.out.println(d.equals(d2));

        System.out.println(new Date().toString());

    }

}

class Order {

    int i;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Order order = (Order) o;
        return i == order.i;
    }

    @Override
    public int hashCode() {
        return Objects.hash(i);
    }
}
